<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<style type="text/css">
		.a1 {
			width: 200px;
			height: 200px;
		}
	</style>
	<body>
		<div>我是div</div>

		<input type="text">
		<button>惦记我移除div点击事件</button>
		<div class="a1">sssssad</div>
		<button class="btn">点击我</button>
		<script type="text/javascript">
			var div = document.querySelector("div");
			var click_fn = function() {
				console.log("ssss");
			};
			div.addEventListener("dblclick", click_fn)
			document.querySelector("button").addEventListener("click", function() {

				div.removeEventListener("click", click_fn)
			})
			document.querySelector("input").addEventListener("keypress", function(e) {
				console.log(e);
			})
			var time1 = new Date().getTime();
			var btn = document.querySelector(".btn");
			var a1 = document.querySelector(".a1");
			btn.addEventListener("click", function() {
			var time2 = new Date().getTime();
			if (time2 - time1 <= 200) {
				a1.style.backgroundColor =
					`rgb(${Math.floor(Math.random()*256)},${Math.floor(Math.random()*256)},${Math.floor(Math.random()*256)})`;
					console.log("1");
			} else {
				time1 = time2;
				console.log("2");
			}
			})
			
		</script>
	</body>
</html>
